﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SerieInterface;

namespace MyInteractiveSerieList
{
    public class SerieInfo : ISerieInfo
    {
        private string serieName;
        private string serieFullPath;
        private bool nextExist;

        public SerieInfo(string serieName, string serieFullPath, bool nextExist)
        {
            this.serieFullPath = serieFullPath;
            this.serieName = serieName;
            this.nextExist = nextExist;
        }

        public string SerieName
        { 
            get { return serieName; } 
        }

        public string SerieFullPath
        {
            get { return serieFullPath; }
        }

        public bool NextExist
        {
            get { return nextExist; }
            set { nextExist = value; }
        }


        #region Overriding some methods

        public override string ToString()
        {
            return string.Format("{0}", this.serieName);
        }

        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;

            if (this.GetType() != obj.GetType())
                return false;

            SerieInfo otherSerieInfo = (SerieInfo)obj;

            if (this.serieFullPath == otherSerieInfo.serieFullPath &&
                this.serieName == otherSerieInfo.serieName)
            {
                return true;
            }

            return false;
        }

        public static bool operator ==(SerieInfo a, SerieInfo b)
        {
            if ((object)a == null && (object)b == null)
            {
                return true;
            }
            else if ((object)a == null)
            {
                return false;
            }

            return a.Equals(b);
        }
        

        public static bool operator !=(SerieInfo a, SerieInfo b)
        {
            return !(a == b);
        }
        #endregion
    }
}
